-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: LDO use filled data #540
base: master
Are you sure you want to change the base?
Conversation
The numpy function backend is kind of awkward for non-cubes; it doesn't add much. Can you highlight the problem with code snippet? Is it that the LDOs, when treated as quantities, are not np-maskedarray-like objects? That's probably how they should be treated. Worse case, we might need to replace the current functionality ( |
For a projection with nans:
will return
So the numpy functions will default to the Quantity array, which is not affected by our masking routines. We would need to update the |
Yeah... this is tricky. I think we do want to utilize the np masked array tools, which involves (afaik) setting the |
Alright, I'll start exploring that. It may be possible to just not use the cube mask classes and assume we won't need things like lazy masking for LDOs (seems reasonable to me). I think it is useful for a number of operations (I need it for convolving heavily masked maps). It's probably more important to have the same behaviour as the cube operations, though. |
Right, it's probably important to determine which cases care about the distinction between masked-value-is-nan, masked-value-is-np-masked, masked-value-is-number, and masked-value-isn't-masked (the last of which we want to avoid). Convolution should be happy with either of the first two. |
Can we continue outlining how this will work in practice? I think the most important thing about this PR is documentation. Some examples:
The last bit represents the behavior that we want to change; Similarly, we presently have no |
A nice thing with the above approach is that arithmetic operations should in general return the same data with preserved masks, e.g. |
@keflavich -- We have some odd behaviour in the LDO classes from inheriting from
u.Quantity
and the mix-in classes that used to only be for cubes. For example, the cubes will usecube.filled_data[:]
for most operations and a Projection usesproj.value
.Other operations like changing the
fill_value
were also failing (and weren't being tested) because the mask was always being initialized to all beTrue
. With these changes, the mask can now be updated but changing the fill value only changesfilled_data
and not the Quantity array.A bunch of tests are still missing. Before adding them, I figured we should decide on how to handle these behaviours. One option would be to stop inheriting from
Quantity
and implement the numpy function backend used for the cubes. It seems like any solution here could get messy.